package cool.mtc.minghe.data.model.sys.role.form;

import cool.mtc.minghe.data.entity.sys.role.RoleDO;
import cool.mtc.web.model.form.LongIdFormSupport;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.beans.BeanUtils;

/**
 * @author yz
 */
@Schema(description = "表单")
@Data
public class RoleForm implements LongIdFormSupport {
    
    @Schema(description = "ID")
    private Long roleId;

    @Schema(description = "角色编码")
    private String code;

    @Schema(description = "角色名称")
    private String name;

    @Schema(description = "角色描述")
    private String description;

    @Schema(description = "排序")
    private Integer orderIndex;

    @Override
    public Long getId() {
        return roleId;
    }

    public RoleDO transToDO() {
        RoleDO roleDO = new RoleDO();
        this.updateDO(roleDO);
        return roleDO;
    }

    public void updateDO(RoleDO roleDO) {
        BeanUtils.copyProperties(this, roleDO);
    }
}
